package controllers

import (
	"fmt"
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/config"
)

type HookController struct {
	beego.Controller
}

// POST处理数据
func (c *HookController) Post() {

	fmt.Println(string(c.Ctx.Input.RequestBody))



	//var ob models.Object
	//var err error
	//if err = json.Unmarshal(c.Ctx.Input.RequestBody, &ob); err == nil {
	//	objectid := models.AddOne(ob)
	//	c.Data["json"] = "{\"ObjectId\":\"" + objectid + "\"}"
	//} else {
	//	c.Data["json"] = err.Error()
	//}
	//c.ServeJSON()
}

// GET打印相关配置
func (c *HookController) Get() {
	iniconf, err := config.NewConfig("ini", beego.AppPath + "/conf/gitlab.conf")
	if err != nil {
		fmt.Println(err)
	} else {
		var alias map[string] string
		aliasConf, _ := iniconf.DIY("alias")
		alias = aliasConf.(map[string] string)
		fmt.Println(alias)
	}

}